package com.atguigu05.method_more._04recursion.exer2;

/**
 * ClassName: RabbitExer
 * Package: com.atguigu05.method_more._04recursion.exer2
 * Description:
 *
 * @Author xiao_qi
 * @Create 2024/4/11 21:18
 * @Version 1.0
 */
public class RabbitExer {
    public static void main(String[] args){
        RabbitExer rabbit = new RabbitExer();
        int cishu=rabbit.rabbit(24);
        System.out.println("一共有："+cishu+"对兔子");
    }
    public int rabbit(int mounth){
        if(mounth == 1||mounth==2){
            return 1;
        }
        else {
            return rabbit(mounth-2)+rabbit(mounth -1);
        }
    }
}
